package com.wuseguang.springcloud.controller;

import com.wuseguang.springcloud.service.StudentCenterService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/brands")
public class StudentCenterController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private StudentCenterService service;

    /**
     * @描述 登陆个人空间效验密码
     * @创建人 zm
     * @创建时间 2020/3/28
     */
    @RequestMapping("/StudentCenterLogin")
    public Result StudentCenterLogin(@RequestParam(value = "id") Integer id, @RequestParam(value = "password") String password) {//學生id
        logger.info("StudentCenterLogin==>id={},password={}", id, password);
        return service.StudentCenterLogin(id, password);
    }

    /**
     * @描述 学生中心
     * @创建人 zm
     * @创建时间 2020/3/28
     */
    @RequestMapping("/queryStudentCenterAll")
    public Result queryStudentCenterAll(@RequestParam(value = "deviceid") String deviceid) {
        logger.info("StudentCenterLogin==>deviceid={}", deviceid);
        return service.queryStudentCenterAll(deviceid);
    }

    /**
     * @描述 个人空间应用列表
     * @创建人 zm
     * @创建时间 2020/3/29
     */
    @RequestMapping("/queryPersonalApplication")
    public Result queryPersonalApplication(@RequestParam(value = "deviceid") String deviceid,@RequestParam(value = "id") Integer id) {
        logger.info("queryPersonalApplication==>deviceid={}", deviceid);
        return service.queryPersonalApplication(deviceid,id);
    }


    /**
     * @Author zm
     * @Description  根据学生id修改卡号
     * @Date 2020/10/15 11:32
     */
    @RequestMapping("/updateStudentCardNumber")
    public Result updateStudentCardNumber(@RequestParam(value = "cardNumber") String cardNumber,@RequestParam(value = "id") Integer id) {
        logger.info("updateStudentCardNumber==>cardNumber={}", cardNumber);
        return service.updateStudentCardNumber(id,cardNumber);
    }
}
